<?php
class Kuisioner extends CI_Model {
	function __construct() {
		parent::__construct();
	}
	
	function get($where = NULL){
		if($where != NULL){
			$this->db->where($where);
		}
		$this->db->from('kuisioner');
		return $this->db->get();
	}
	
	function add($data){
		$this->db->insert('kuisioner',$data);
		return $this->db->insert_id();
	}
	
	function edit($id,$data){
		$this->db->where('id_kuisioner',$id);
		return $this->db->update('kuisioner',$data);
	}
	
	function delete($id){
		$this->db->where('id_kuisioner',$id);
		return $this->db->delete('kuisioner');
	}
	
	//pilihan jawaban
	function get_pilihan_jawaban($where = NULL){
		if($where != NULL){
			$this->db->where($where);
		}
		$this->db->from('pilihan_kuisioner');
		return $this->db->get();
	}
	
	function add_pilihan_jawaban($data){
		$this->db->insert('pilihan_kuisioner',$data);
		return $this->db->insert_id();
	}
	
	function edit_pilihan_jawaban($id,$data){
		$this->db->where('id_pilihan',$id);
		return $this->db->update('pilihan_kuisioner',$data);
	}
}